home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / emstools.arc / EMMLIB.ARC / EMM16_A.ASM < prev    next >
Assembly Source File  |  1990-02-04  |  7KB  |  125 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM16_A.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   get_partial_context                                     ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function saves a partial mapping context for       ;
  7. ;                     specific mappable memory regions in a system.  Because  ;
  8. ;                     this function saves only a subset of the entire mapping ;
  9. ;                     context, it uses less memory for the save structure and ;
  10. ;                     may be potentially faster than get_context.  The        ;
  11. ;                     function copies the contents of selected mapping        ;
  12. ;                     hardware from each expanded memory board to a           ;
  13. ;                     destination structure.                                  ;
  14. ;                                                                             ;
  15. ;                     The application must pass a pair of far pointers.  The  ;
  16. ;                     first points to a structure that specifies which        ;
  17. ;                     mappable segments to save.  The second points to the    ;
  18. ;                     destination structure.                                  ;
  19. ;                                                                             ;
  20. ;                     Use this function instead of save_context &             ;
  21. ;                     restore_context if you need to save or restore the      ;
  22. ;                     mapping context but don't want to (or have to) use a    ;
  23. ;                     handle.                                                 ;
  24. ;                                                                             ;
  25. ;           PASSED:   &pcl:                                                   ;
  26. ;                        is a far pointer to a structure that specifies only ;
  27. ;                        those mappable memory regions which are to have      ;
  28. ;                        their mapping context saved.                         ;
  29. ;                        The structure members are described here:            ;
  30. ;                                                                             ;
  31. ;                        pcl.mappable_region_count:                           ;
  32. ;                           is the number of entries in the                   ;
  33. ;                           mappable_region_seg() array member (the one       ;
  34. ;                           immediately following mappable_region_count).     ;
  35. ;                           This number should not exceed the number of       ;
  36. ;                           mappable segments in the system.                  ;
  37. ;                                                                             ;
  38. ;                        pcl.mappable_region_seg():                           ;
  39. ;                           is the segment addresses of the mappable memory   ;
  40. ;                           regions whose mapping contexts are to be saved.   ;
  41. ;                           The segment address must be a mappable segment.   ;
  42. ;                           Use the get_mappable_regions function to          ;
  43. ;                           determine which segments are mappable.            ;
  44. ;                                                                             ;
  45. ;                     &dest_context:                                          ;
  46. ;                        is a far pointer to the destination structure of the ;
  47. ;                        mapping context to be saved.                         ;
  48. ;                                                                             ;
  49. ;         RETURNED:   status:                                                 ;
  50. ;                        is the status EMM returns from the call.  All other  ;
  51. ;                        returned results are valid only if the status        ;
  52. ;                        returned is zero.  Otherwise they are undefined.     ;
  53. ;                                                                             ;
  54. ;                     dest_context:                                           ;
  55. ;                        is a structure containing the state of all the       ;
  56. ;                        mapping hardware on all boards in the system.  It    ;
  57. ;                        also contains any information necessary to restore   ;
  58. ;                        the boards to their original state when the program  ;
  59. ;                        invokes a set_context or get_set_context function.   ;
  60. ;                        The structure member is described here:              ;
  61. ;                                                                             ;
  62. ;                        dest_context.reserved:                               ;
  63. ;                           is a character array which is reserved for use by ;
  64. ;                           the memory manager.  In this instance it contains ;
  65. ;                           the data for the mapping hardware state.          ;
  66. ;                                                                             ;
  67. ; C USE CONVENTION:   unsigned int                status;                     ;
  68. ;                     PARTIAL_CONTEXT_LIST_STRUCT pcl [MAX_MAPPABLE_REGIONS]; ;
  69. ;                     CONTEXT_STRUCT              dest_context;               ;
  70. ;                                                                             ;
  71. ;                     pcl.mappable_region_count  = 2;                         ;
  72. ;                     pcl.mappable_region_seg[0] = 0xC000;                    ;
  73. ;                     pcl.mappable_region_seg[1] = 0xC400;                    ;
  74. ;                     status = get_partial_context (&pcl,                     ;
  75. ;                                                   &dest_context);           ;
  76. ;-----------------------------------------------------------------------------;
  77. .XLIST
  78. PAGE    60,132
  79.  
  80. IFDEF SMALL
  81.    .MODEL SMALL, C
  82. ENDIF
  83. IFDEF MEDIUM
  84.    .MODEL MEDIUM, C
  85. ENDIF
  86. IFDEF LARGE
  87.    .MODEL LARGE, C
  88. ENDIF
  89. IFDEF COMPACT
  90.    .MODEL COMPACT, C
  91. ENDIF
  92. IFDEF HUGE
  93.    .MODEL HUGE, C
  94. ENDIF
  95.  
  96. INCLUDE emmlib.equ
  97. INCLUDE emmlib.str
  98. INCLUDE emmlib.mac
  99. .LIST
  100. .CODE
  101.  
  102. get_partial_context    PROC                                                  \
  103.             USES DS SI DI,                                        \
  104.             ptr_context_list_struct:FAR PTR BYTE,                     \
  105.             ptr_context:FAR PTR BYTE
  106.  
  107.     ;---------------------------------------------------------------------;
  108.     ;   do;                                                               ;
  109.     ;   .   get the partial mapping context from EMM;                     ;
  110.     ;---------------------------------------------------------------------;
  111.     MOVE        AX, get_partial_page_map_fcn
  112.     MOVE        DS:SI, ptr_context_list_struct
  113.     MOVE        ES:DI, ptr_context
  114.     INT         EMM_int
  115.  
  116.     ;---------------------------------------------------------------------;
  117.     ;   .   return (EMM status);                                          ;
  118.     ;   end;                                                              ;
  119.     ;---------------------------------------------------------------------;
  120.     RET_EMM_STAT    AH
  121.  
  122. get_partial_context    ENDP
  123.  
  124. END
  125.